using UnityEngine;

namespace GameCore
{
    public class ProcedureManager : MonoBehaviour
    {
        public IProcedure CurrentProcedure { get; private set; }

        public void ChangeProcedure(IProcedure procedure)
        {
            CurrentProcedure?.OnExit();
            CurrentProcedure = procedure;
            CurrentProcedure.OnEnter();
        }

        public void Update()
        {
            CurrentProcedure?.OnUpdate();
        }
    }
}